package com.szrt.scott.filter;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CharacterFilter extends BasicFilter {
	
	@SuppressWarnings("unused")
	private String characterCode="utf-8";

	public void init(FilterConfig config) throws ServletException {
		
		this.characterCode=  config.getInitParameter("characterCode");
	}
	
	@Override
	public void myFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		chain.doFilter(request, response);
	}

	
}
